<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionView::Template::Handlers::ERB</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActionView::Template::Handlers::ERB 
            
                <span class="parent">&lt; 
                    
                    <a href="../../../Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../../../files/actionpack/lib/action_view/template/handlers/erb_rb.html">actionpack/lib/action_view/template/handlers/erb.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="ERB.html#method-c-call">call</a>,
              </li>
            
              
              <li>
                <a href="ERB.html#method-i-call">call</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>H</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="ERB.html#method-i-handles_encoding-3F">handles_encoding?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="ERB.html#method-i-supports_streaming-3F">supports_streaming?</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">ENCODING_TAG</td>
            <td>=</td>
            <td class="attr-value">Regexp.new(&quot;\\A(&lt;%#{ENCODING_FLAG}-?%&gt;)[ \\t]*&quot;)</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-call">
            
              <b>call</b>(template)
            
            <a href="ERB.html#method-c-call" name="method-c-call" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-call_source')" id="l_method-c-call_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/bd308a0d02c4a6459c05770a564405986a663f47/actionpack/lib/action_view/template/handlers/erb.rb#L93" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-call_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/handlers/erb.rb, line 93</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">template</span>)
  <span class="ruby-identifier">new</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">template</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-call">
            
              <b>call</b>(template)
            
            <a href="ERB.html#method-i-call" name="method-i-call" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-call_source')" id="l_method-i-call_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/bd308a0d02c4a6459c05770a564405986a663f47/actionpack/lib/action_view/template/handlers/erb.rb#L105" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-call_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/handlers/erb.rb, line 105</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">call</span>(<span class="ruby-identifier">template</span>)
  <span class="ruby-comment"># First, convert to BINARY, so in case the encoding is</span>
  <span class="ruby-comment"># wrong, we can still find an encoding tag</span>
  <span class="ruby-comment"># (&lt;%# encoding %&gt;) inside the String using a regular</span>
  <span class="ruby-comment"># expression</span>
  <span class="ruby-identifier">template_source</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">source</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">ASCII_8BIT</span>)

  <span class="ruby-identifier">erb</span> = <span class="ruby-identifier">template_source</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-constant">ENCODING_TAG</span>, <span class="ruby-string">''</span>)
  <span class="ruby-identifier">encoding</span> = <span class="ruby-node">$2</span>

  <span class="ruby-identifier">erb</span>.<span class="ruby-identifier">force_encoding</span> <span class="ruby-identifier">valid_encoding</span>(<span class="ruby-identifier">template</span>.<span class="ruby-identifier">source</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">encoding</span>)

  <span class="ruby-comment"># Always make sure we return a String in the default_internal</span>
  <span class="ruby-identifier">erb</span>.<span class="ruby-identifier">encode!</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">erb_implementation</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-identifier">erb</span>,
    <span class="ruby-value">:escape</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">escape_whitelist</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">template</span>.<span class="ruby-identifier">type</span>),
    <span class="ruby-value">:trim</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">erb_trim_mode</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;-&quot;</span>)
  ).<span class="ruby-identifier">src</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-handles_encoding-3F">
            
              <b>handles_encoding?</b>()
            
            <a href="ERB.html#method-i-handles_encoding-3F" name="method-i-handles_encoding-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-handles_encoding-3F_source')" id="l_method-i-handles_encoding-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/bd308a0d02c4a6459c05770a564405986a663f47/actionpack/lib/action_view/template/handlers/erb.rb#L101" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-handles_encoding-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/handlers/erb.rb, line 101</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">handles_encoding?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-supports_streaming-3F">
            
              <b>supports_streaming?</b>()
            
            <a href="ERB.html#method-i-supports_streaming-3F" name="method-i-supports_streaming-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-supports_streaming-3F_source')" id="l_method-i-supports_streaming-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/bd308a0d02c4a6459c05770a564405986a663f47/actionpack/lib/action_view/template/handlers/erb.rb#L97" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-supports_streaming-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/handlers/erb.rb, line 97</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">supports_streaming?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    